<script setup>
import { ref, watch } from "vue";

const count = ref(0);

function increment() {
  count.value++;
}

watch(
  count,
  (newValue, oldValue) => {
    console.log(`count changed from ${oldValue} to ${newValue}`);
  },
  { deep: false, immediate: false }
);
</script>

<template>
  <div>
    <p>{{ count }}</p>
    <button @click="increment">Increment</button>
  </div>
</template>